package pyx.crazycards.game.managers;

import java.io.Serializable;

import pyx.crazycards.game.managers.annotation.DataObject;
import pyx.crazycards.game.managers.annotation.Propertie;

/**
 * Represents a cost, of a card to be draw.
 * 
 * @author Abraao Isvi
 * 
 */
@DataObject(name = "valueProperties", base = "crazy.cards.game")
public class ValueProperties implements Serializable {
	
	@Propertie(name = "serial", load=false)
	private static final long serialVersionUID = 5621260582964903177L;

	@Propertie(name = "fire")
	private Integer fire = 0;

	@Propertie(name = "earth")
	private Integer earth = 0;

	@Propertie(name = "wind")
	private Integer wind = 0;

	@Propertie(name = "water")
	private Integer water = 0;

	@Propertie(name = "light")
	private Integer light = 0;

	@Propertie(name = "dark")
	private Integer dark = 0;

	@Propertie(name = "power")
	private Integer power = 0;

	@Propertie(name = "defense")
	private Integer defense = 0;

	@Propertie(name = "wisdom")
	private Integer wisdom = 0;

	public Integer getDefense() {
		return defense;
	}

	public void setDefense(Integer defense) {
		this.defense = defense;
	}

	public Integer getFire() {
		return fire;
	}

	public void setFire(Integer fire) {
		this.fire = fire;
	}

	public Integer getEarth() {
		return earth;
	}

	public void setEarth(Integer earth) {
		this.earth = earth;
	}

	public Integer getWind() {
		return wind;
	}

	public void setWind(Integer wind) {
		this.wind = wind;
	}

	public Integer getWater() {
		return water;
	}

	public void setWater(Integer water) {
		this.water = water;
	}

	public Integer getLight() {
		return light;
	}

	public void setLight(Integer light) {
		this.light = light;
	}

	public Integer getDark() {
		return dark;
	}

	public void setDark(Integer dark) {
		this.dark = dark;
	}

	public Integer getPower() {
		return power;
	}

	public void setPower(Integer power) {
		this.power = power;
	}

	public Integer getWisdom() {
		return wisdom;
	}

	public void setWisdom(Integer wisdom) {
		this.wisdom = wisdom;
	}

	public void addFire(Integer fire) {
		if(fire == null)
			return;
		
		this.fire += fire;
	}

	public void addEarth(Integer earth) {
		if(earth == null)
			return;
		
		this.earth += earth;
	}

	public void addWind(Integer wind) {
		if(wind == null)
			return;
		
		this.wind += wind;
	}

	public void addWater(Integer water) {
		if(water == null)
			return;
		
		this.water += water;
	}

	public void addLight(Integer light) {
		if(light == null)
			return;
		
		this.light += light;
	}

	public void addDark(Integer dark) {
		if(dark == null)
			return;
		
		this.dark += fire;
	}

	public void addPower(Integer power) {
		if(power == null)
			return;
		
		this.power += power;
	}

	public void addWisdom(Integer wisdom) {
		if(wisdom == null)
			return;
		
		this.wisdom += wisdom;
	}

	/**
	 * Verify if the elemental properties of this object are smaller or equals
	 * to the object passed through parameter
	 * 
	 * @param value
	 *            the value to verify
	 * @return true if the value satisfies
	 */
	public boolean satisfy(ValueProperties value) {
		boolean ret = false;

		ret &= value.fire >= fire;
		ret &= value.earth >= earth;
		ret &= value.wind >= wind;
		ret &= value.water >= water;
		ret &= value.light >= light;
		ret &= value.dark >= dark;

		return ret;
	}
}
